package cn.cloud.all.security.oauth2.provider.code;

import cn.cloud.all.security.oauth2.provider.OAuth2Authentication;

import java.util.concurrent.ConcurrentHashMap;

public class InMemoryAuthorizationCodeServices extends RandomValueAuthorizationCodeServices {

    private final ConcurrentHashMap<String, OAuth2Authentication> authorizationCodeStore = new ConcurrentHashMap<String, OAuth2Authentication>();

    @Override
    protected void store(String code, OAuth2Authentication authentication) {
        this.authorizationCodeStore.put(code, authentication);
    }

    @Override
    public OAuth2Authentication remove(String code) {
        return this.authorizationCodeStore.remove(code);
    }
}
